//
//  ViewController.swift
//  闭包与函数
//
//  Created by mac on 15/11/9.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    
    func demo(text: String)->(Int){
        print("hello" + text)
        if text == "tt"{
            return 18
        } else {
            return 100
        }
    }
    func demo1 ()->(){
        print("haha")
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        test1(demo1)
    }
    func test1(finished: ()->()){
        finished()
    }
    
    func test(finished: (text: String)->(Int)){
        let age = finished(text: "tt")
        
        if age > 20{
            print("dale")
        } else {
            print("kawayi")
        }
    }
    
}

